function pagination(url, page, maxpage)
{
	var str = '';
	var x = 9;
	var j = (page-x < 1) ? 1 : page-x;
	var k = (page+x > maxpage) ? maxpage : page + x;

	if (j > 1)
	{
		str += (" <a href='" + url.replace('{p}', 1) + "' class='pagelink'>[1]</a> ... ");
	}
	for (var i=j; i<=k; i++)
	{
		if (i == page)
		{
			str += ("<span class='t2 pagelink'>[" + i.toString() + "]</span> ");
			continue;
		}
		str += ("<a href='" + url.replace('{p}', i) + "' class='pagelink'>[" + i.toString() + "]</a> ");
	}
	if (maxpage > k)
	{
		str += (" ... <a href='" + url.replace('{p}', maxpage) + "' class='pagelink'>[" + maxpage + "]</a>");
	}

	var elements = document.getElementsByTagName('code');
	for (var i=0; i<elements.length; i++)
	{
		if (elements[i].getAttribute('name') != 'pagination')
		{
			continue;
		}
		elements[i].innerHTML = str;
	}
}



function collapse(sender, floor)
{
	var obj = document.getElementById('floor_' + floor);
	if (obj)
	{
		if (obj.style.display == '')
		{
			obj.style.display = 'none';
			sender.innerHTML += '...';
			return;
		}
		obj.style.display = '';
		sender.innerHTML = sender.innerHTML.replace('...', '');
	}
}